package com.zqs.service.impl;

import com.zqs.entity.Hire;
import com.zqs.entity.Product;
import com.zqs.mapper.HireMapper;
import com.zqs.mapper.ProductMapper;
import com.zqs.service.HireService;
import com.zqs.service.ex.HireNothingnessException;
import com.zqs.service.ex.InsertException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HireServiceImpl implements HireService {

    @Autowired
    private HireMapper hireMapper;

    @Override
    public void addHire(Hire hire,Integer uid) {
        hire.setUid(uid);
        Integer row = hireMapper.addHire(hire);
        if (row != 1){
            throw new InsertException("插入时发生未知错误!");
        }
    }

    @Override
    public List<Hire> getHire(Integer uid) {
        List<Hire> hireList = hireMapper.getHireByUid(uid);
        if (hireList == null){
            throw new HireNothingnessException("租车订单没有找到!");
        }
        return null;
    }
}
